// pages/handleTask/handleTask.js
//获取应用实例 
const app = getApp();
const util = require('../../utils/util.js');
const lbbService = require('../service/service.js');
Page({

    /**
     * 页面的初始数据
     */
    data: {
        hospitalName:'',
        endTime:'',
        InspectionNumber:'100',
        taskNumber:'20',
        background: "#f2f2f2",
        activeKey:0,
        active:0,
        scrollHeight:450,
        imgArrays:[
            'http://127.0.0.1:10848/tmp/mcDOQ6kG6N4V87899dd86a6eef035f97fdae93534cc3.jpg',
            'http://127.0.0.1:10848/tmp/mcDOQ6kG6N4V87899dd86a6eef035f97fdae93534cc3.jpg',
            'http://127.0.0.1:10848/tmp/mcDOQ6kG6N4V87899dd86a6eef035f97fdae93534cc3.jpg',
            'http://127.0.0.1:10848/tmp/mcDOQ6kG6N4V87899dd86a6eef035f97fdae93534cc3.jpg'
    ],
        maintenancetasks:{
                install: [
                   {
                    taskname:'安装',
                    remarks:'这是备注内容',
                    ftime:"2021-11-12",
                    ctime:"2022-09-16"
                   }
                ]
    },
        content:{
            tasktype:[
                {
                    type:'转入任务',
                    taskname:'控制盒巡检',
                    num1:'20',
                    num2:'10',
                    id:"66666"
                }
            ],
            gateway:[
                {
                    taskname:'网关充电', 
                    list:[
                        {num:"2158555",id:0},
                        {num:"2158555",id:0},
                        {num:"2158555",id:1},
                    ]
                }
            ],
            phote:[
                {
                    taskname:'设备拍照', 
                    num1:'20',
                    num2:'10',
                    num3:"15",
                    num4:"8",
                    id:"12554"
                }
            ],
            Gatewayphoto:[
                {
                    taskname:'网关天线位置拍照', 
                    type:'转入任务',
                    num1:'20',
                    num2:'10',
                    id:"88888"
                }
            ],
            pilephote:[
                {
                    taskname:'桩/控制盒螺丝拍照', 
                    num1:'15',
                    num2:'5',
                    id:"12664"
                }
            ]
        }
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        let that=this
        that.setData({
            endTime:options.time,
            hospitalName:options.hospitalName,
            userId:options.userId,
            hospitalId:options.hospitalId
        })
        console.log("==)",options)
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {

    },
    //切换侧边栏
    changeStat(e){
        let that=this
        that.setData({
            activeKey:e.detail
         })
    },
    tabChange(e){
        this.setData({
            active:e.detail.index
        })
    },
    //点击完成
    tocomplete:function(e){
        wx.showModal({
            title:'完成控制盒巡检',
            content:'您还未全部扫码租赁控制盒,确定完成巡检吗？',
            showCancel:true,
            confirmText:'确定',
            success(res){
                if(res.confirm){
                    console.log('点击确定')
                }
            }
        })
    },
    //点击已充电
    Charged(e){
        wx.showModal({
            title:'已充电',
            content:'确定已完成网关充电吗？',
            showCancel:true,
            confirmText:'确定',
            success(res){
                if(res.confirm){
                    console.log('点击确定')
                }
            }
        })
    },
    //去处理
    goHandle(){
        wx.showModal({
            title:'问题处理',
            placeholderText:'填写备注内容',
            showCancel:true,
            confirmText:'提交',
            editable:true,
            success(res){
                if(res.confirm){
                    console.log(res)
                }
            }
        })
    },
    //预览图片
    preViewImgs(e){
        let current=e.currentTarget.dataset.current
        let urls=this.data.imgArrays
        util.previewImgs(current, urls);
    },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})